<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8" />
    <title>谷粒商城 - 抢购成功</title>
    <script type="text/javascript" th:src="@{/js/jquery-3.1.1.min.js}"></script>
    <script type="text/javascript" th:src="@{/bootstrap/js/bootstrap.js}"></script>
    <script type="text/javascript" th:src="@{/js/swiper.min.js}"></script>
	<script th:src="@{/js/swiper.min.js}"></script>
    <link rel="stylesheet" type="text/css" th:href="@{/css/swiper.min.css}" />
    <link rel="stylesheet" type="text/css" th:href="@{/bootstrap/css/bootstrap.css}" />
    <link rel="stylesheet" type="text/css" th:href="@{/css/success.css}" />

</head>

    <body>
    <!--头部-->
    <div class="alert-info">
        <div class="hd_wrap_top">
        <ul class="hd_wrap_left">
        <li class="hd_home"><i class="glyphicon glyphicon-home"></i>
        <a href="/javascript:;">谷粒商城首页</a>
        </li>

        </ul>

        <ul class="hd_wrap_right">
        <li class="forel">
        <a href="/javascript:;" class="link_login">你好,请登录</a>&nbsp;
    <a href="/javascript:;" class="link_regist">免费注册</a>
        </li>
        <li class="spacer"></li>

        <li>
        <a href="/javascript:;">我的订单</a>
        </li>



        </ul>

        </div>
      </div>

        <div class="nav-tabs-justified">
        <div class="nav_wrap">

        <div class="nav_top">
        <div class="nav_top_one">
        <a href="/static#"><img th:src="@{/img/logo1.jpg}" style="height: 60px;width:180px;"  /></a>
        </div>
        <div class="nav_top_two"><input type="text" /><button>搜索</button></div>





    </div>

    </div>
    </div>

    <div class="main">

        <div class="success-wrap">
            <div class="w" id="result">
                <div class="m succeed-box">
                    <div th:if="${orderSn != null}" class="mc success-cont">
                        <h2 style="color: green;">恭喜，秒杀成功！订单号[[${orderSn}]]</h2>
                        <h3>订单准备中，<span class="secRedirect" data=${orderSn}"">5</span>s后自动跳转支付
                            <a class="btn-gopay"  th:href="${'http://localhost:8008/order/aliPayOrder?orderSn=' + orderSn}">去支付</a>
                        </h3>
                    </div>
                    <div th:if="${orderSn == null}" class="mc success-cont">
                        <h3>差一点点，没有抢到</h3>
                        <h3><span class="secRedirect">5</span>s后跳转到首页</h3>
                    </div>
                </div>
            </div>
        </div>
    </div>
    </body>
    <script type="text/javascript" th:src="@{/js/success.js}"></script>

    <script>
        let s = window.setInterval("subTime()", 1000);
        function subTime(){
            $(".secRedirect").html($(".secRedirect").html() - 1);

            if($(".secRedirect").html() == 0){
                // 停止倒计时
                window.clearInterval(s);
                // 如果有orderSN跳转支付，否则去首页
                if($(".secRedirect").attr("data")){
                    window.location.replace($(".btn-gopay").attr("href"))
                }else {
                    window.location.replace('http://localhost:8100/')
                }
            }
        }

    </script>

</html>
